<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns a list of currently configured servers</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.mysqlnd-ms-dump-servers" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mysqlnd_ms_dump_servers</h1>
  <p class="verinfo">(No version information available, might only be in Git)</p><p class="refpurpose"><span class="refname">mysqlnd_ms_dump_servers</span> &mdash; <span class="dc-title">Returns a list of currently configured servers</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.mysqlnd-ms-dump-servers-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   
   <span class="methodname"><strong>mysqlnd_ms_dump_servers</strong></span>
    ( <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$connection</code></span>
   ) : <span class="type">array</span></div>

  <p class="para rdfs-comment">
    Returns a list of currently configured servers.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mysqlnd-ms-dump-servers-parameters">
  <h3 class="title">参数</h3>
  <dl>

   
    <dt>
<code class="parameter">connection</code></dt>

    <dd>

     <p class="para">
      A MySQL connection handle obtained from any of the
      connect functions of the <a href="ref.mysqli.html" class="link">mysqli</a>,
      <a href="ref.mysql.html" class="link">mysql</a> or
      <a href="ref.pdo_mysql.html" class="link">PDO_MYSQL</a> extensions.
     </p>
    </dd>

   
  </dl>

 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mysqlnd-ms-dump-servers-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   <strong><code>FALSE</code></strong> on error. Otherwise, returns an array with two entries
   <em>masters</em> and <em>slaves</em> each of which contains
   an array listing all corresponding servers.
  </p>
  <p class="para">
   The function can be used to check and debug the list of servers currently
   used by the plugin. It is mostly useful when the list of servers changes at
   runtime, for example, when using MySQL Fabric.
  </p>
  <p class="para">
   <em>masters</em> and <em>slaves</em> server entries
  </p>
  <table class="doctable informaltable">
   
    <col width="1*" />
    <col width="7*" />
    <col width="2*" />
    <thead>
     <tr>
      <th>Key</th>
      <th>Description</th>
      <th>Version</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>
       <em>name_from_config</em>
      </td>
      <td>
       <p class="para">
         Server entry name from config, if appliciable. NULL if no
         configuration name is available.
       </p>
      </td>
      <td>Since 1.6.0.</td>
     </tr>

     <tr>
      <td>
       <em>hostname</em>
      </td>
      <td>
       <p class="para">
         Host name of the server.
       </p>
      </td>
      <td>Since 1.6.0.</td>
     </tr>

     <tr>
      <td>
       <em>user</em>
      </td>
      <td>
       <p class="para">
         Database user used to authenticate against the server.
       </p>
      </td>
      <td>Since 1.6.0.</td>
     </tr>

     <tr>
      <td>
       <em>port</em>
      </td>
      <td>
       <p class="para">
         TCP/IP port of the server.
       </p>
      </td>
      <td>Since 1.6.0.</td>
     </tr>

       <tr>
      <td>
       <em>socket</em>
      </td>
      <td>
       <p class="para">
         Unix domain socket of the server.
       </p>
      </td>
      <td>Since 1.6.0.</td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 unknown-returnvaluet" id="refsect1-function.mysqlnd-ms-dump-servers-unknown-returnvaluet">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    <span class="function"><strong>mysqlnd_ms_dump_servers()</strong></span> requires
    PECL mysqlnd_ms &gt;&gt; 1.6.0.
   </p>
  </p></blockquote>
 </div>


  <div class="refsect1 examples" id="refsect1-function.mysqlnd-ms-dump-servers-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-2269">
    <p><strong>Example #1 <span class="function"><strong>mysqlnd_ms_dump_servers()</strong></span> example</strong></p>
     <div class="example-contents">
<div class="inicode"><pre class="inicode">{
    &quot;myapp&quot;: {
        &quot;master&quot;: {
            &quot;master1&quot;: {
                &quot;host&quot;:&quot;master1_host&quot;,
                &quot;port&quot;:&quot;master1_port&quot;,
                &quot;socket&quot;:&quot;master1_socket&quot;,
                &quot;db&quot;:&quot;master1_db&quot;,
                &quot;user&quot;:&quot;master1_user&quot;,
                &quot;password&quot;:&quot;master1_pw&quot;
            }
        },
        &quot;slave&quot;: {
             &quot;slave_0&quot;: {
                 &quot;host&quot;:&quot;slave0_host&quot;,
                 &quot;port&quot;:&quot;slave0_port&quot;,
                 &quot;socket&quot;:&quot;slave0_socket&quot;,
                 &quot;db&quot;:&quot;slave0_db&quot;,
                 &quot;user&quot;:&quot;slave0_user&quot;,
                 &quot;password&quot;:&quot;slave0_pw&quot;
             },
             &quot;slave_1&quot;: {
                 &quot;host&quot;:&quot;slave1_host&quot;
             }
        }
    }
}</pre>
</div>
    </div>

 <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$link&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysqli_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"myapp"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"global_user"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"global_pass"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"global_db"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1234</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"global_socket"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">mysqlnd_ms_dump_servers</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

    <div class="example-contents"><p>以上例程会输出：</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(2) {
  [&quot;masters&quot;]=&gt;
  array(1) {
    [0]=&gt;
    array(5) {
      [&quot;name_from_config&quot;]=&gt;
      string(7) &quot;master1&quot;
      [&quot;hostname&quot;]=&gt;
      string(12) &quot;master1_host&quot;
      [&quot;user&quot;]=&gt;
      string(12) &quot;master1_user&quot;
      [&quot;port&quot;]=&gt;
      int(3306)
      [&quot;socket&quot;]=&gt;
      string(14) &quot;master1_socket&quot;
    }
  }
  [&quot;slaves&quot;]=&gt;
  array(2) {
    [0]=&gt;
    array(5) {
      [&quot;name_from_config&quot;]=&gt;
      string(7) &quot;slave_0&quot;
      [&quot;hostname&quot;]=&gt;
      string(11) &quot;slave0_host&quot;
      [&quot;user&quot;]=&gt;
      string(11) &quot;slave0_user&quot;
      [&quot;port&quot;]=&gt;
      int(3306)
      [&quot;socket&quot;]=&gt;
      string(13) &quot;slave0_socket&quot;
    }
    [1]=&gt;
    array(5) {
      [&quot;name_from_config&quot;]=&gt;
      string(7) &quot;slave_1&quot;
      [&quot;hostname&quot;]=&gt;
      string(11) &quot;slave1_host&quot;
      [&quot;user&quot;]=&gt;
      string(12) &quot;gloabal_user&quot;
      [&quot;port&quot;]=&gt;
      int(1234)
      [&quot;socket&quot;]=&gt;
      string(13) &quot;global_socket&quot;
    }
  }
}
</pre></div>
    </div>
   </div>
  </p>
 </div>


</div></div></div></body></html>